-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Make the dialogUserController a little bit more API driven #6400
Conversation
app/assets/javascripts/controllers/dialog_user/dialog_user_controller.js
Outdated
Show resolved
Hide resolved
11aa4d9
to
fe88b9c
Compare
if (field.type == 'DialogFieldTagControl') { | ||
promises.push(API.get('/api/categories/' + field.options.category_id + '/tags?expand=resources&attributes=categorization').then(function(response) { | ||
field.values = response.resources.map(function(tag) { | ||
return { value: tag.id, name: tag.name, description: tag.categorization.description }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return { id: tag.id, name: tag.name, description: tag.categorization.description };
should work
dialog-user is using fieldValue.id as fieldValue.description for fieldValue in vm.dialogField.values
so value
is ignored
* Extract the data initialization into a separate step * Extract the readiness mark into a separate step * Make the promise chain flat and easier to understand
fe88b9c
to
736b6b6
Compare
Checked commits skateman/manageiq-ui-classic@161b52d~...736b6b6 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation. |
Closing as we're not taking this approach... |
I went through the initialization process of the
dialogUserController
, flattened the promise chain and started thinking about retrieving stuff from the API. So far I was successful with the replacing of default values when duplicating a service request. The tags are also loaded from the API, replacing the original values coming from the schema.Eventually, I don't want to have these values in the dialog schema, but that's something we need to change in the backend. Also we can exist without this change for a while 😉
There are some issues with the
TagControl
right now, because it's not using themiqSelect
that has been already utilized in the dropdowns, but a fix is already on its way.The backend also sends us in the schema the
<None>
and<Choose>
elements in dropdowns, which is a bad practice. My plan is to move this logic into the frontend as it is a presentation layer matter and it has nothing to do with the backend, that should provide data only. This would affect theDropdownList
as well, because it uses a similar logic, but as its values are static, it would need a backend change.Related issue: ManageIQ/manageiq#19483
@miq-bot add_label refactoring, ivanchuk/no, angular dialogs